'''
Created on Nov 25, 2009
# Problem Set 3 (Part II)
# Name: Noah Spahn
# Collaborators: none
# Time: 4:00
'''
from string import *

def subStringMatchExact(target,key):
	'''
    Returns a tuple of indexes for matching instances of key in the provided target
    target : string
    key : string (assumption: it is a sub string of target)
    '''
	start = 0
	position = 0
	list = ()
	while position != -1:
		position = find(target,key,start)
		if position >= 0:	list = list + (position,)#list.append(position)
		start = position + len(key)
		# print position
	return list

t0 = "bbatgacatgcacaagtatgcatatgcatgc"
t1 = 'atgacatgcacaagtatgcat'
t2 = 'atgaatgcatggatgtaaatgcag'

k0 = 'a'
k1 = 'atg'
k2 = 'atgc'
k3 = 'atgca'

print subStringMatchExact(t1,k1)

# References
#    http://docs.python.org/tutorial/introduction.html#strings
#    http://stackoverflow.com/questions/509211/good-primer-for-python-slice-notation
#    http://docs.python.org/library/stdtypes.html